import axios from 'axios'
import vuex from '@/store'
export default function (callback, params) {
	let equnique = vuex.getters.geteqid;
	var setting = params.setting;
		if(typeof setting !== 'object') {
			var req = {
				reason: '请求错误',
				status: 888,
				data: null
			};
			return callback(req);
		}
		let data = params.data;
		data ? data = Object.assign({equnique: equnique}, data) : data = null;
		return axios({
			method: setting.method,
			timeout: 1000*10,
			baseURL: 'http://172.17.130.167/studiesViewApp/public/Index',
			url: setting.url,
			data: data,
			contentType: setting.contentType ? setting.contentType : null,
			headers: setting.headers ? setting.headers : null
		}).then(
			function (res) {
				res = res.data;
				callback(res);
			}.bind(this),
			function (res) {
				var req = {
					reason: '网络错误',
					status: 999,
					data: null
				};
				callback(req);
			}.bind(this)
		);
}